#include <windows.h>
#include "lv3.h"

extern HANDLE comHandle1;
extern HANDLE comHandle2;
//extern void ErrorHandler(char *, DWORD );

int w_pc(int sp_fd, char *str)
{
   int st;
   DWORD numWrite;

   if ( sp_fd == 1)
      st = WriteFile(comHandle1, str, strlen(str), &numWrite, 0);
   else if ( sp_fd == 2)
      st = WriteFile(comHandle2, str, strlen(str), &numWrite, 0);
   

   return(numWrite);
}

int r_pc(int sp_fd, char *str)
{
   int st;
   DWORD numRead;

   if ( sp_fd == 1 )
      st = ReadFile(comHandle1, str, 100, &numRead, 0);
   else if ( sp_fd == 2 )
      st = ReadFile(comHandle2, str, 100, &numRead, 0);

   return(numRead);
}
